package day0911_2;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class A2 {
    public static void main(String[] args) {
        ArrayList<String> list=new ArrayList();//给集合list限制元素类型
        list.add("王维");
        list.add("张浩然");
        list.add("李白");
        list.add("陈舒婷");
        list.add("赵子龙");//1.
        list.add(0,"老子");
        //"老子"  "王维"   "张浩然"   "李白"  "陈舒婷"   "赵子龙"
        int pos=list.indexOf("李白");//6.结果是3  //判断"李白第一次出现的位置"
        int position=list.lastIndexOf("李白");//7.结果是3
        System.out.println("list = " + list);
        String name=list.remove(4);//8.//删除"陈舒婷"
        boolean isDel=list.remove("赵子龙");//9.

    }
}
